package cn.com.lms.business.questionnaire.service;

import cn.com.lms.business.questionnaire.persistence.entity.QuestionnaireInfo;
import cn.com.lms.business.questionnaire.persistence.repository.QuestionnaireInfoRepository;


import com.bnzj.core.persistence.BaseService;
import com.bnzj.core.persistence.query.QueryHelpBean;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 16266
 * @DateTime: 2020/3/20 15:30
 * @Description: 问卷信息业务层
 */
@Service
public class QuestionnaireInfoService extends BaseService<QuestionnaireInfoRepository, QuestionnaireInfo,Long> {

    /**
     * 条件构造
     * @return
     */
    public QueryHelpBean getQueryHelpBean() {
        String selectSQL = "select  d.* ";
        String whereSQL = " from bnz_questionnaire_info d where 1=1 ";
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL, "select count(1)" + whereSQL, QuestionnaireInfo.class);
        return queryBean;
    }

    public QuestionnaireInfo findByIdAndIsDeleteEqual(Long id,Boolean isDelete) {
        return repository.findByIdAndIsDeleteEquals(id,isDelete);
    }

    public Integer updateIsDelete(boolean isDelete, List<Long> id) {
        return  repository.updateIsDelete(isDelete,id);
    }
}
